﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WisPortal.Models;

namespace WisPortal
{
    public class BaseController : Controller
    {
        public const int CODE_SUCCESS = 0;
        public const int CODE_ERROR_NODATAFOUND = 1;
        public const int CODE_ERROR_CONFIG = 2;
        public const int CODE_ERROR_EXECUTE = 3;

        
        public JsonResult GetResult(int code, string msg)
        {
            return GetResult(code, msg, null);
        }

        public JsonResult GetResult(int code, string msg,Dictionary<string,string>obj)
        {
            CustomResult cr = new CustomResult();
            cr.Code = code;
            cr.Description = msg;
            cr.Object = obj;
            return Json(cr, JsonRequestBehavior.AllowGet);
        }
    }
}
